<script setup>
import {reactive} from "vue";

const data = reactive({
  visible: false,
  fileId: "",
  dirId: "",
  fileName: "",
  fileMd5: "",
  fileSize: "",
  createTime: "",
});

function openFileDetailDialog(detail) {
  data.visible = true;
  data.fileId = detail.fileId;
  data.dirId = detail.dirId;
  data.fileName = detail.name;
  data.fileMd5 = detail.fileMd5;
  data.fileSize = (detail.fileSize / 1024).toFixed(0) + " KB";
  data.createTime = detail.createTime;
}

defineExpose({
  openFileDetailDialog,
});
</script>

<template>
  <el-dialog v-model="data.visible" title="文件夹详情" width="600">
    <el-form label-position="right" label-width="140">
      <el-form-item label="文件ID：">
        <el-input v-model="data.fileId" readonly/>
      </el-form-item>
      <el-form-item label="所属文件夹ID：">
        <el-input v-model="data.dirId" readonly/>
      </el-form-item>
      <el-form-item label="文件名称：">
        <el-input v-model="data.fileName" readonly/>
      </el-form-item>
      <el-form-item label="文件MD5：">
        <el-input v-model="data.fileMd5" readonly/>
      </el-form-item>
      <el-form-item label="文件大小：">
        <el-input v-model="data.fileSize" readonly/>
      </el-form-item>
      <el-form-item label="创建时间：">
        <el-input v-model="data.createTime" readonly/>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="danger" @click="data.visible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<style lang="scss" scoped>

</style>